<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:html>
<head>
<html:base />
<title><bean:message key="Application.Name"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/formas.css" rel="stylesheet" type="text/css">
<link href="css/formas.css" rel="stylesheet" type="text/css">
<script LANGUAGE="JavaScript" type="text/javascript" src="js/AnchorPosition.js"></script>
<script LANGUAGE="JavaScript" type="text/javascript" src="js/PopupWindow.js"></script>
<script LANGUAGE="JavaScript" type="text/javascript" src="js/date.js"></script>
<script LANGUAGE="JavaScript" type="text/javascript" src="js/CalendarPopup.js"></script>
<script language="javascript" type="text/javascript" src="js/util.js"></script>
<script language="javascript" type="text/javascript">
	function fnc_validarForma(forma){
		var bol_retVal = true;
		var str_errores = "";
		<%java.util.ArrayList arrL_total =  (java.util.ArrayList)request.getAttribute( "lst_studentCal" );%>
		var int_total = <%=arrL_total.size()%>;
		for( var int_i = 0; int_i < int_total; int_i++ ){
			var evalCal = eval("forma.int_calificacion"+int_i+".value");
			if(Trim(evalCal) != ""){
				if(!esNumero(evalCal,0)){
					str_errores += " - <bean:message key='Grades.error.integer'/>\n";
					break;
				}else{
					if( parseFloat(evalCal )<0 ){
						str_errores += " - <bean:message key='Grades.error.integer'/>\n";
						break;
					}
				}
			}else{
				
			}
		}
		if( str_errores != "" ){
			bol_retVal = false;
			alert( " <bean:message key='Application.Error(s)'/> : \n" + str_errores );
		}
		return bol_retVal;
	}
	<logic:present name="req_msg">
		alert("<bean:write name='req_msg'/>");
	</logic:present>
</script>
</head>
<body>
<%int int_i = 0; %>
	<table cellpadding="0" cellspacing="0" class="formas">
    	<tr>
        	<td>
		   	<table cellpadding="0" cellspacing="0" class="barraNavegacion">
       			<tr>
				<td><html:link action="/academy_welcome?action=selectAcademy" 	styleClass="barraNavegacion"> <img src="images/icn_liga.gif" border="0">	<bean:message key="AcademyWelcome.Init" /></html:link> 
						 <html:link action="/students_crn_list" styleClass="barraNavegacion"><img src="images/icn_liga.gif" border="0"><bean:message key="CRN.list" />	</html:link> 
						 <html:link action="/teachers_grade" name="bn_crn" property="map_id" styleClass="barraNavegacion"><img src="images/icn_liga.gif" border="0"><bean:message key="Grades.Name" />	</html:link> 
				</td>
			</tr>
		    </table>
		  	<table cellpadding="0" cellspacing="0" class="titulo">
	        	 <tr>
	                	<td class="iconos_imgs"><a href="mailto:<bean:message key="Application.mailto"/>"><img src="images/icn_correo.gif" width="18" height="18" border="0"></a></td>
	                	<td class="txt_titulo"><bean:message key="Grade.Edit"/></td>
		         </tr>
          	</table>
 			<form action="<html:rewrite action="/student_grades_save"/>"/ onsubmit="return fnc_validarForma(this);">	
 			<input type="hidden" name="studentId" value="<bean:write name="bn_student" property="code" />" />	
 			<input type="hidden" name="crn" value="<bean:write name="bn_crn" property="cnr"/>" />	
 			<input type="hidden" name="ciclo" value="<bean:write name="bn_crn" property="ciclo"/>" />
			<table cellpadding="0" cellspacing="2" class="info_formas">
        		<tr> 
          			<td class="formas-txtInfo"><bean:message key="Grades.instructions"/></td>
        		</tr>
        		<table cellpadding="0" cellspacing="2" class="info_titulo">
        			<tr> 
						<td colspan="2" class="formas-encabezado"><bean:message key="StudyPlan.subject.subjectData"/></td>
					</tr>
           			<tr> 
						<td>						
							<table cellpadding="0" cellspacing="2" class="info_titulo">
								<tr> 
									<td class=""><strong><bean:message key="StudyPlan.subject"/></strong></td>
									<td class=""><bean:write name="bn_crn" property="materia_tk"/> - <bean:write name="bn_crn" property="materia_desc"/></td>
								</tr>
								<tr> 
									<td class=""><strong><bean:message key="Menu.Student"/></strong></td>
									<td class=""><bean:write name="bn_student" property="code" /> - <bean:write name="bn_student" property="name"  /></td>
								</tr>						
		            		</table>
	          			<td> 
					</tr>
					<tr>
						<td class="formas-encabezado"><bean:message key="Grades.Criterion" /></td>
						<td class="formas-encabezado"><bean:message key="Grade.Name" /></td>				
					</tr>
					<logic:iterate id="calificaciones" name="lst_studentCal" >
					<tr> 									
						<td>
							<bean:write name="calificaciones" property="str_criterio"/>
						</td>								 									
						<td>
							<input type="text" size="3" name="int_calificacion<%=int_i%>" value="<bean:write name="calificaciones" property="int_calificacion"/>"/>		
							<input type="hidden" name="int_criterioId<%=int_i%>" value="<bean:write name="calificaciones" property="int_criterioId"/>"/>		
							<input type="hidden" name="int_calId<%=int_i%>" value="<bean:write name="calificaciones" property="int_calId"/>"/>
						</td>
					</tr>			
					<%int_i++;%>		
					</logic:iterate>
					<tr> 
						<td colspan="2" align="center">
							<div align="center">
								<html:submit property="btn_aceptar"><bean:message key="Application.Accept" /></html:submit>
								<input type="button" onclick="location.href='<html:rewrite action="/teachers_grade" name="bn_crn" property="map_id"/>';" value="<bean:message key='Application.Cancel'/>"/>
							</div>
						</td>
					</tr>
				</table>
				</table>
			</form>
		</td>
		</table>
	</td>
	</tr>
</table></td>
</body>
</html:html>
